<?php

namespace app\admin\model;

use app\common\model\City;
use think\Model;
use traits\model\SoftDelete;

class Carers extends Model
{
    // 表名
    protected $name = 'user';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';

    // 追加属性
    protected $append = [

    ];

    public function getGenderList()
    {
        return ['1' => __('Male'), '0' => __('Female')];
    }

    public function city()
    {
        return $this->belongsTo(City::class, 'city_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function group()
    {
        return $this->belongsTo('UserGroup', 'group_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function invite()
    {
        return $this->belongsTo(User::class, 'pid', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
